home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
090
/
pctj8411.arc
/
TEST.BAS
< prev
Wrap
BASIC Source File
|
1986-09-14
|
2KB
|
95 lines
'Program Name: TEST.BAS
'Author: William L. Colsher
'Date Written: May 21, 1984
'Purpose: This program exercises the 3Com/EtherNet Semaphore
' protocol implemented in the Assembly language program
' ELOCK.ASM
'
'Variables: DR% - EtherShare disk drive number
' SEM$ - Semaphore name
' RC% - Return code from EtherShare
' TI% - Time Out value for WAITLOCK
'
DR%=5
'First Test - Attempt to lock a simple semaphore
SEM$="TESTSEMAPHORE0001"+CHR$(0)
CALL LOCK(DR%,SEM$,RC%)
PRINT "Return code from simple LOCK is: ";RC%
GOSUB 5000
'Second Test - Unlock the Semaphore just locked
CALL UNLOCK(DR%,SEM$,RC%)
PRINT "Return code from UNLOCK is: ";RC%
GOSUB 5000
'Third Test - Try to force some errors. First standalone error
' is #3 - Invalid semaphore name.
SEM$="THIS IS AN INVALID SEMAPHORE NAME"+CHR$(0)
CALL LOCK(DR%,SEM$,RC%)
PRINT "Return code from attempted invalid semaphore name is:";RC%
GOSUB 5000
'Fourth Test - Try for a semaphore list full error: #4. We have to
' LOCK 51 semaphores to do it.
FOR I=1 TO 50
SEM$="SEMAPHORE"+STR$(I)+CHR$(0)
CALL LOCK(DR%,SEM$,RC%)
NEXT I
SEM$="THE LAST SEMAPHORE"+CHR$(0)
CALL LOCK(DR%,SEM$,RC%)
PRINT "Return code from 51st LOCK is:";RC%
GOSUB 5000
'Clean up the mess
FOR I=1 TO 50
SEM$="SEMAPHORE"+STR$(I)+CHR$(0)
CALL UNLOCK(DR%,SEM$,RC%)
NEXT I
'Fifth Test - Invalid drive ID is return code 5.
SEM$="TEST SEMAPHORE"+CHR$(0)
DR%=1
CALL LOCK(DR%,SEM$,RC%)
PRINT "Return code from LOCK with Drive ID=0 is: ";RC%
GOSUB 5000
'Sixth Test - The last stand alone error is #9, Semaphore
' Already Locked by this PC.
DR%=5
CALL LOCK(DR%,SEM$,RC%)
CALL LOCK(DR%,SEM$,RC%)
PRINT "Return code from duplicate LOCK is: ";RC%
GOSUB 5000
CALL UNLOCK(DR%,SEM$,RC%)
STOP
5000 'This routine displays error messages
5010 ON RC%+1 GOSUB 5100,5200,5300,5400,5500,5600,5700,5800,5900,6000
5020 RETURN
5100 PRINT"Operation successful":RETURN
5200 PRINT"Semaphore currently locked":RETURN
5300 PRINT"Server not responding":RETURN
5400 PRINT"Invalid semaphore name":RETURN
5500 PRINT"Semaphore list full":RETURN
5600 PRINT"Invalid drive id":RETURN
5700 PRINT"Invalid Ethernet address":RETURN
5800 PRINT"Not logged in":RETURN
5900 PRINT"Write to network failed":RETURN
6000 PRINT"Semaphore already locked by this PC":RETURN
END